export const getBlobUrl = (url) =>
  new Promise((resolve, reject) => {
    const xhr = new XMLHttpRequest();
    xhr.open("GET", url, true);
    xhr.responseType = "blob";
    xhr.onload = function () {
      if (this.status === 200) {
        const blob = this.response;
        const b = URL.createObjectURL(blob);
        resolve(b);
      }
    };
    xhr.send();
  });
